package com.lhwzs.myssm.util;

import com.lhwzs.user.dao.IUserDAO;
import com.lhwzs.user.dao.impl.ClassmessageImpl;
import com.lhwzs.user.dao.impl.UserDAOImpl;
import com.lhwzs.user.pojo.Message;
import com.lhwzs.user.pojo.User;
import org.junit.Test;

import java.util.List;
import java.util.Random;

/**
 * @Auther: 李燦
 * @Date: 2022/5/5 - 05 - 21:21
 * @Decsription: com.lhwzs.myssm.util
 * @version: 1.0
 */
public class tes1 {
    @Test
    public void aa(){
        IUserDAO dao=new UserDAOImpl();
        User u = new User();
        u.setUsername("T1002");
        u.setPassword("123456");
        User user=dao.login(u);
        System.out.println(user);
    }
    @Test
    public void bb(){
        IUserDAO dao=new UserDAOImpl();
        Integer userId=193010747;
        int aa=dao.deluser(userId);
        System.out.println(aa);
    }
    @Test
    public void cc(){
        Random aa=new Random();
        aa.nextInt(27);

    }
    @Test
    public void gg(){
        IUserDAO dao=new UserDAOImpl();
        String keyword="";
        int pageNo=1;
        Integer institute=1;
        List<User> userList = dao.getuserList(keyword , pageNo,institute);
        System.out.println(userList);
    }
    @Test
    public void ll(){
        IUserDAO dao=new ClassmessageImpl();
        int lican=193010206;
        Message classmessage = dao.getclassById(lican);
        System.out.println(classmessage);
    }
    @Test
    public void pp(){
        IUserDAO dao=new UserDAOImpl();
        int userId=193010205;
        String newpwd="123456";
        if(dao.updatepwd(userId, newpwd)>0){
            System.out.println("密码修改成功");
        }else {
            System.out.println("密码修改失败");
        }

    }
    @Test
    public void kk(){
        IUserDAO dao=new UserDAOImpl();
        User u = new User();
        u.setUsername("腊肉饼饼");
        u.setPassword("123456");
        // 访问数据库
        User query = dao.login(u);
        if (query != null) {// 登录成功
            System.out.println("成功登录");
        } else {// 登录失败
            System.out.println("账号或密码错误！");
        }
    }
}
